# -*- coding: utf-8 -*-
"""
Created by #zqy_TheBest on 2024/6/8
Description: 
"""

# Your code goes here
import json
import re
import time
from .getPublicData import *


import re

def get_car_data():
    cars = list(getAllCars())
    car_data = []

    for car in cars:
        # 使用正则表达式查找所有的数字并将其转换为字符串
        car.price = re.findall('\d+\.\d+', car.price)
        car.price ='-'.join(car.price)

        car_data.append({
            "brand": car.brand,
            "rank": car.rank,
            "carImg": car.carimg,
            "manufacturer": car.manufacturer,
            "carModel": car.carmodel,
            "price": car.price,
            "saleVolume": car.salevolume,
            "marketTime": car.marketime,
            "energyType": car.energytype,
            "carName": car.carname,
            #"insure": car.insure
        })

    print(car_data)

    return car_data
